from django.shortcuts import render
from django.shortcuts import render_to_response
from django.template import RequestContext
from searchform.models import SearchForm
from searchform.forms import roomsform

def search_list(request):
     rooms_info = SearchForm.objects.raw("SELECT id, hotel_name, address_hotel, country_name FROM rooms  ")
     room_data = {
        "room_detail" : rooms_info
    }


     print room_data
     return render_to_response('searchroom/searchform.html',room_data,context_instance = RequestContext(request))


def room_list(request):
    if request.method == 'POST':
        form = roomsform(request.POST)
        if form.is_valid():
            country = request.POST["country"]
            date_checkin = request.POST["date_checkin"]
            date_checkout = request.POST["date_checkout"]


    else:
        form = roomsform()
        return render(request, 'searchform.html',{'data':form})

